home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Text / WASTE / WASTE 1.1.2 Distribution / Pseudo-UPI for THINK Pascal / Aliases.p < prev    next >
Encoding:
Text File  |  1995-10-12  |  3.9 KB  |  118 lines  |  [TEXT/PJMM]

  1. unit Aliases;
  2.  
  3. { Pascal Interface to the Macintosh Libraries }
  4.  
  5. { Copyright © Apple Computer Inc. }
  6. { All Rights Reserved }
  7.  
  8. { Adapted for use with THINK Pascal 4.0.x by Marco Piovanelli }
  9.  
  10. interface
  11.  
  12.     const
  13.  
  14.         rAliasType = 'alis';                                { aliases are stored as resources of this type }
  15.  
  16. { define alias resolution action rules mask }
  17.  
  18.         kARMMountVol = $00000001;                { mount the volume automatically }
  19.         kARMNoUI = $00000002;                        { no user interface allowed during resolution }
  20.         kARMMultVols = $00000008;                { search on multiple volumes }
  21.         kARMSearch = $00000100;                    { search quickly }
  22.         kARMSearchMore = $00000200;            { search further }
  23.         kARMSearchRelFirst = $00000400;        { search target on a relative path first }
  24.  
  25. { define alias record information types }
  26.  
  27.         asiZoneName = -3;                                { get zone name }
  28.         asiServerName = -2;                                { get server name }
  29.         asiVolumeName = -1;                            { get volume name }
  30.         asiAliasName = 0;                                    { get aliased file/folder/volume name }
  31.         asiParentName = 1;                                { get parent folder name }
  32.  
  33.  
  34.     type
  35.  
  36. { define the alias record that will be the blackbox for the caller }
  37.  
  38.         AliasPtr = ^AliasRecord;
  39.         AliasHandle = ^AliasPtr;
  40.         AliasRecord = record
  41.                 userType: OSType;                            { appl stored type like creator type }
  42.                 aliasSize: Integer;                                { alias record size in bytes, for appl usage }
  43.             end;
  44.  
  45.         AliasInfoType = Integer;                        { alias record information type }
  46.         AliasFilterProcPtr = ProcPtr;
  47.  
  48. {  create a new alias between fromFile-target and return alias record handle  }
  49.     function NewAlias (fromFile: FSSpecPtr;
  50.                                     target: FSSpec;
  51.                                     var alias: AliasHandle): OSErr;
  52.     inline
  53.         $7002, $A823;
  54.  
  55. { create a minimal new alias for a target and return alias record handle }
  56.     function NewAliasMinimal (target: FSSpec;
  57.                                     var alias: AliasHandle): OSErr;
  58.     inline
  59.         $7008, $A823;
  60.  
  61. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  62.     function NewAliasMinimalFromFullPath (fullPathLength: INTEGER;
  63.                                     fullPath: Ptr;
  64.                                     zoneName: Str32;
  65.                                     serverName: Str31;
  66.                                     var alias: AliasHandle): OSErr;
  67.     inline
  68.         $7009, $A823;
  69.  
  70. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  71.     function ResolveAlias (fromFile: FSSpecPtr;
  72.                                     alias: AliasHandle;
  73.                                     var target: FSSpec;
  74.                                     var wasChanged: BOOLEAN): OSErr;
  75.     inline
  76.         $7003, $A823;
  77.  
  78. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  79.     function GetAliasInfo (alias: AliasHandle;
  80.                                     index: AliasInfoType;
  81.                                     var theString: Str63): OSErr;
  82.     inline
  83.         $7007, $A823;
  84.  
  85. {  given a file spec, return target file spec if input file spec is an alias.}
  86. {    It resolves the entire alias chain or one step of the chain.  It returns}
  87. {    info about whether the target is a folder or file; and whether the input}
  88. {    file spec was an alias or not.}
  89.     function ResolveAliasFile (var theSpec: FSSpec;
  90.                                     resolveAliasChains: BOOLEAN;
  91.                                     var targetIsFolder: BOOLEAN;
  92.                                     var wasAliased: BOOLEAN): OSErr;
  93.     inline
  94.         $700C, $A823;
  95.  
  96. {   Low Level Routines }
  97. {given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag}
  98.     function MatchAlias (fromFile: FSSpecPtr;
  99.                                     rulesMask: LONGINT;
  100.                                     alias: AliasHandle;
  101.                                     var aliasCount: INTEGER;
  102.                                     aliasList: FSSpecArrayPtr;
  103.                                     var needsUpdate: BOOLEAN;
  104.                                     aliasFilter: AliasFilterProcPtr;
  105.                                     yourDataPtr: univ Ptr): OSErr;
  106.     inline
  107.         $7005, $A823;
  108.  
  109. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  110.     function UpdateAlias (fromFile: FSSpecPtr;
  111.                                     target: FSSpec;
  112.                                     alias: AliasHandle;
  113.                                     var wasChanged: BOOLEAN): OSErr;
  114.     inline
  115.         $7006, $A823;
  116.  
  117. implementation
  118. end.